
<?php
	include 'connectDB.php';

$retour = mysql_query("SELECT COUNT(*) AS nb_commande FROM commande WHERE etat='Finaliser' OR etat='Annuler'");
$donnees = mysql_fetch_array($retour);
$totalCommande = $donnees['nb_commande'];  
 
$reponse = mysql_query("SELECT * FROM commande WHERE etat='Finaliser' OR etat='Annuler' ORDER BY id_com DESC") or die(mysql_error()); // Requ�te SQL
 

 ?>
 
	<!-- Affichons maintenant le contenu du panier -->
	<div>	
			<table style="text-align:center;  text-transform : uppercase ; font-weight : bold ; " border="1" >
				<tr>			
					<td style="width:500px; font-size : 1.1em ; "> COMMANDE FINALIS&Eacute;ES </td>
				</tr>		
			</table>
	</div><br />
	
	<center>
	<table style="width:500px;">
		<tr class="date">
			<strong>
		      <td style="width:20px" >N�</td>
		      <td style="width:100px" >Client</td>
		      <td style="width:100px" >Date</td>
		      <td style="width:40px" >Montant</td>
		      <td style="width:60px">Etat</td>
			</strong> 
		</tr>
 
 <?php
if ($totalCommande <= 0)	echo "<tr><td colspan='5'><center><strong>Vous n'avez aucune commande valid&eacute;s</strong></center></td><tr>";
else{
// On fait une boucle pour lister tout ce que contient la table :
while ($donnees = mysql_fetch_array($reponse) )
{
?>		
		<tr>
			<td><?php echo $donnees['id_com']; ?></td>
			<td><?php echo $donnees['code_client']; ?></td>
			<td><?php echo $donnees['datecom']; ?></td>
			<td><?php echo $donnees['montant']; ?>&euro;</td>
			<td><?php echo $donnees['etat']; ?></td>
		</tr>
<?php
}}
?> 
	</table>
	</center>
<?php  
mysql_close(); // D�connexion de MySQL
?>
